package com.cg.controller;

import com.cg.dto.Result;
import com.cg.dto.ResultUtils;
import com.cg.entity.Dictionary;
import com.cg.service.DictionaryService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Dictionary)表控制层
 *
 * @author chengong
 * @since 2023-12-01 10:24:30
 */
@RestController
@RequestMapping("/dict")
public class DictionaryController {
    /**
     * 服务对象
     */
    @Resource
    private DictionaryService dictionaryService;

    /**
     * 根据type表的typeCode查询Dictionary类型
     */
    @PostMapping("/queryDicByTypeCode")
    public Result<List<Dictionary>> queryDicByTypeCode(@RequestParam("typeCode") String typeCode){
        List<Dictionary> dictionaries = dictionaryService.queryDicByTypeCode(typeCode);
        return ResultUtils.returnDataSuccess(dictionaries);
    }

}

